Introduction

Data Analysis

heart.clean <-
  heart %>% 
  # there are several discrete features with low cardinality so 
  # treating them as factors
  mutate(
    isMale = factor(male),
    education.factor = factor(education),
    currentSmoker.factor = factor(currentSmoker),
    prevalentStroke.factor = factor(prevalentStroke),
    prevalentHyp.factor = factor(prevalentHyp),
    diabetes.factor = factor(diabetes),
    TenYearCHD.factor = factor(TenYearCHD),
    BPMeds.factor = factor(BPMeds)
  ) %>% 
  select(-c(prevalentStroke, male, education, prevalentHyp, diabetes, currentSmoker, TenYearCHD, BPMeds))

heart.clean %>% ggpairs(
  aes(color = TenYearCHD.factor, alpha = 0.3),
    # correlation text is off so this makes it readable
   upper = list(continuous = wrap("cor", size = 3, hjust=0, alignPercent=1)),
   title = c("Scatterplot by Ten Year CHD"),
  ) + labs(caption = "Figure 1. Relationships between features are explored in regards to whether or not the patient was diagnosed with CHD within 10 years.")

Observations

Missing Data

# show missingness Graph
md.pattern(heart.clean, rotate.names = TRUE)

There are 645 rows which contain missing data. The indicator graph shows that missing data typically falls into a select few fields. This indicates that the data is not Missing Completely at Random (MCAR).

# Run Little's Test to determine if the data is Missing Completely at Random (MCAR)
LittleMCAR(heart.clean)$p.value
## this could take a while
## [1] 4.955219e-08

There is convincing evidence that the missing data is not completely random (Little’s Test). Thus, it is inappropriate to drop the data as it would be dropping meaningful patterns from the analysis. Therefore, the missing values will be imputed using Multiple Imputation with Markov Chain Monte Carlo simulations.

Analysis

# create a 30% sample for training data. The 30% is arbitrary
heart.samples <- 
  stratified(heart.clean, c("TenYearCHD.factor"), .3, bothSets = TRUE)

heart.testing <- heart.samples$SAMP1  %>% 
  mutate(TenYearCHD = as.numeric(as.character(TenYearCHD.factor))) %>% 
    select(-education.factor)

heart.training <- heart.samples$SAMP2  %>% 
  mutate(TenYearCHD = as.numeric(as.character(TenYearCHD.factor))) %>% 
    select(-education.factor)

heart.drop.testing <-
  heart.testing %>% 
    drop_na

heart.drop.training <-
  heart.training %>% 
    drop_na

heart.impute.testing <- mice(heart.testing, m = 10, maxit = 50, seed = 123)
## 
##  iter imp variable
##   1   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   1   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   1   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   1   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   1   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   1   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   1   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   1   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   1   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   1   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   2   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   2   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   2   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   2   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   2   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   2   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   2   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   2   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   2   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   2   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   3   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   3   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   3   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   3   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   3   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   3   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   3   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   3   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   3   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   3   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   4   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   4   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   4   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   4   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   4   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   4   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   4   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   4   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   4   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   4   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   5   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   5   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   5   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   5   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   5   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   5   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   5   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   5   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   5   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   5   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   6   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   6   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   6   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   6   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   6   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   6   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   6   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   6   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   6   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   6   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   7   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   7   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   7   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   7   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   7   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   7   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   7   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   7   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   7   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   7   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   8   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   8   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   8   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   8   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   8   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   8   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   8   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   8   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   8   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   8   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   9   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   9   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   9   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   9   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   9   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   9   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   9   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   9   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   9   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   9   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   10   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   10   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   10   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   10   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   10   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   10   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   10   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   10   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   10   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   10   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   11   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   11   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   11   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   11   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   11   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   11   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   11   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   11   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   11   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   11   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   12   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   12   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   12   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   12   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   12   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   12   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   12   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   12   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   12   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   12   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   13   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   13   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   13   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   13   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   13   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   13   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   13   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   13   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   13   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   13   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   14   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   14   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   14   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   14   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   14   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   14   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   14   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   14   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   14   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   14   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   15   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   15   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   15   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   15   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   15   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   15   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   15   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   15   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   15   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   15   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   16   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   16   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   16   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   16   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   16   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   16   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   16   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   16   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   16   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   16   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   17   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   17   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   17   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   17   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   17   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   17   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   17   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   17   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   17   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   17   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   18   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   18   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   18   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   18   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   18   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   18   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   18   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   18   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   18   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   18   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   19   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   19   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   19   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   19   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   19   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   19   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   19   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   19   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   19   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   19   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   20   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   20   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   20   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   20   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   20   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   20   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   20   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   20   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   20   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   20   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   21   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   21   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   21   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   21   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   21   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   21   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   21   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   21   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   21   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   21   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   22   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   22   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   22   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   22   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   22   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   22   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   22   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   22   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   22   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   22   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   23   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   23   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   23   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   23   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   23   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   23   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   23   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   23   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   23   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   23   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   24   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   24   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   24   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   24   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   24   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   24   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   24   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   24   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   24   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   24   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   25   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   25   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   25   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   25   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   25   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   25   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   25   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   25   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   25   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   25   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   26   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   26   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   26   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   26   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   26   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   26   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   26   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   26   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   26   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   26   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   27   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   27   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   27   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   27   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   27   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   27   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   27   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   27   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   27   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   27   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   28   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   28   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   28   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   28   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   28   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   28   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   28   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   28   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   28   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   28   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   29   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   29   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   29   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   29   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   29   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   29   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   29   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   29   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   29   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   29   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   30   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   30   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   30   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   30   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   30   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   30   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   30   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   30   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   30   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   30   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   31   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   31   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   31   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   31   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   31   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   31   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   31   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   31   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   31   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   31   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   32   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   32   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   32   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   32   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   32   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   32   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   32   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   32   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   32   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   32   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   33   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   33   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   33   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   33   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   33   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   33   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   33   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   33   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   33   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   33   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   34   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   34   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   34   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   34   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   34   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   34   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   34   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   34   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   34   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   34   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   35   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   35   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   35   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   35   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   35   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   35   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   35   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   35   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   35   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   35   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   36   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   36   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   36   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   36   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   36   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   36   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   36   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   36   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   36   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   36   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   37   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   37   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   37   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   37   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   37   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   37   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   37   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   37   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   37   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   37   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   38   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   38   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   38   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   38   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   38   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   38   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   38   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   38   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   38   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   38   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   39   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   39   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   39   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   39   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   39   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   39   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   39   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   39   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   39   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   39   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   40   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   40   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   40   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   40   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   40   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   40   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   40   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   40   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   40   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   40   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   41   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   41   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   41   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   41   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   41   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   41   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   41   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   41   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   41   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   41   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   42   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   42   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   42   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   42   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   42   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   42   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   42   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   42   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   42   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   42   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   43   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   43   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   43   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   43   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   43   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   43   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   43   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   43   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   43   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   43   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   44   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   44   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   44   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   44   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   44   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   44   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   44   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   44   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   44   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   44   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   45   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   45   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   45   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   45   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   45   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   45   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   45   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   45   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   45   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   45   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   46   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   46   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   46   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   46   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   46   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   46   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   46   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   46   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   46   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   46   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   47   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   47   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   47   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   47   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   47   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   47   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   47   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   47   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   47   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   47   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   48   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   48   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   48   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   48   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   48   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   48   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   48   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   48   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   48   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   48   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   49   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   49   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   49   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   49   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   49   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   49   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   49   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   49   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   49   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   49   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   50   1  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   50   2  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   50   3  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   50   4  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   50   5  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   50   6  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   50   7  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   50   8  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   50   9  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
##   50   10  cigsPerDay  totChol  BMI  glucose  BPMeds.factor
heart.impute.training <- mice(heart.training, m = 10, maxit = 50, seed = 123)
## 
##  iter imp variable
##   1   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   1   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   1   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   1   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   1   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   1   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   1   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   1   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   1   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   1   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   2   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   2   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   2   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   2   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   2   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   2   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   2   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   2   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   2   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   2   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   3   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   3   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   3   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   3   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   3   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   3   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   3   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   3   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   3   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   3   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   4   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   4   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   4   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   4   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   4   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   4   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   4   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   4   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   4   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   4   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   5   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   5   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   5   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   5   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   5   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   5   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   5   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   5   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   5   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   5   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   6   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   6   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   6   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   6   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   6   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   6   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   6   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   6   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   6   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   6   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   7   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   7   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   7   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   7   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   7   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   7   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   7   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   7   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   7   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   7   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   8   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   8   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   8   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   8   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   8   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   8   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   8   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   8   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   8   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   8   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   9   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   9   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   9   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   9   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   9   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   9   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   9   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   9   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   9   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   9   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   10   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   10   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   10   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   10   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   10   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   10   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   10   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   10   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   10   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   10   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   11   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   11   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   11   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   11   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   11   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   11   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   11   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   11   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   11   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   11   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   12   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   12   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   12   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   12   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   12   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   12   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   12   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   12   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   12   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   12   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   13   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   13   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   13   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   13   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   13   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   13   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   13   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   13   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   13   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   13   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   14   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   14   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   14   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   14   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   14   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   14   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   14   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   14   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   14   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   14   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   15   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   15   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   15   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   15   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   15   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   15   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   15   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   15   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   15   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   15   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   16   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   16   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   16   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   16   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   16   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   16   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   16   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   16   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   16   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   16   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   17   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   17   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   17   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   17   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   17   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   17   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   17   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   17   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   17   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   17   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   18   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   18   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   18   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   18   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   18   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   18   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   18   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   18   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   18   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   18   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   19   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   19   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   19   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   19   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   19   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   19   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   19   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   19   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   19   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   19   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   20   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   20   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   20   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   20   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   20   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   20   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   20   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   20   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   20   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   20   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   21   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   21   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   21   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   21   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   21   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   21   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   21   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   21   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   21   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   21   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   22   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   22   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   22   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   22   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   22   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   22   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   22   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   22   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   22   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   22   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   23   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   23   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   23   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   23   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   23   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   23   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   23   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   23   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   23   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   23   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   24   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   24   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   24   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   24   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   24   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   24   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   24   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   24   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   24   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   24   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   25   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   25   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   25   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   25   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   25   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   25   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   25   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   25   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   25   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   25   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   26   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   26   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   26   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   26   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   26   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   26   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   26   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   26   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   26   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   26   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   27   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   27   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   27   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   27   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   27   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   27   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   27   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   27   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   27   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   27   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   28   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   28   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   28   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   28   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   28   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   28   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   28   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   28   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   28   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   28   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   29   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   29   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   29   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   29   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   29   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   29   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   29   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   29   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   29   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   29   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   30   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   30   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   30   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   30   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   30   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   30   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   30   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   30   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   30   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   30   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   31   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   31   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   31   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   31   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   31   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   31   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   31   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   31   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   31   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   31   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   32   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   32   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   32   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   32   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   32   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   32   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   32   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   32   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   32   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   32   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   33   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   33   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   33   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   33   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   33   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   33   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   33   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   33   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   33   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   33   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   34   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   34   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   34   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   34   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   34   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   34   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   34   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   34   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   34   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   34   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   35   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   35   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   35   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   35   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   35   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   35   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   35   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   35   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   35   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   35   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   36   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   36   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   36   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   36   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   36   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   36   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   36   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   36   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   36   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   36   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   37   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   37   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   37   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   37   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   37   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   37   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   37   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   37   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   37   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   37   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   38   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   38   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   38   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   38   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   38   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   38   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   38   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   38   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   38   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   38   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   39   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   39   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   39   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   39   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   39   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   39   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   39   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   39   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   39   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   39   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   40   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   40   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   40   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   40   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   40   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   40   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   40   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   40   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   40   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   40   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   41   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   41   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   41   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   41   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   41   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   41   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   41   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   41   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   41   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   41   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   42   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   42   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   42   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   42   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   42   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   42   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   42   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   42   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   42   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   42   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   43   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   43   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   43   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   43   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   43   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   43   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   43   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   43   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   43   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   43   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   44   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   44   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   44   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   44   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   44   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   44   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   44   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   44   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   44   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   44   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   45   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   45   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   45   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   45   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   45   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   45   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   45   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   45   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   45   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   45   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   46   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   46   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   46   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   46   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   46   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   46   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   46   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   46   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   46   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   46   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   47   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   47   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   47   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   47   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   47   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   47   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   47   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   47   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   47   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   47   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   48   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   48   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   48   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   48   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   48   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   48   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   48   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   48   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   48   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   48   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   49   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   49   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   49   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   49   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   49   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   49   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   49   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   49   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   49   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   49   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   50   1  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   50   2  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   50   3  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   50   4  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   50   5  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   50   6  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   50   7  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   50   8  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   50   9  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor
##   50   10  cigsPerDay  totChol  BMI  heartRate  glucose  BPMeds.factor

Dropped Data

# as.numeric(as.character(heart.clean$TenYearCHD.factor)): converts factor back to 0 and 1. Otherwise, it is converted to
# 1 and 2.
fit.reg <- glm(
    TenYearCHD ~ age + sysBP + BMI + glucose +  prevalentHyp.factor + prevalentStroke.factor + BPMeds.factor + totChol + cigsPerDay + heartRate,
    family = "binomial", 
    data = heart.drop.training
  )
tidy(fit.reg) %>% 
  kable(
    digits = 4
  ) %>% 
  kable_styling(full_width = T, bootstrap_options = "striped", latex_options = "hold_position")
term estimate std.error statistic p.value
(Intercept) -8.5743 0.7595 -11.2888 0.0000
age 0.0742 0.0078 9.5437 0.0000
sysBP 0.0075 0.0035 2.1585 0.0309
BMI 0.0176 0.0149 1.1871 0.2352
glucose 0.0080 0.0019 4.1947 0.0000
prevalentHyp.factor1 0.2671 0.1623 1.6454 0.0999
prevalentStroke.factor1 1.1635 0.5404 2.1531 0.0313
BPMeds.factor1 0.3595 0.2675 1.3438 0.1790
totChol 0.0022 0.0014 1.6337 0.1023
cigsPerDay 0.0292 0.0046 6.3698 0.0000
heartRate -0.0010 0.0050 -0.2062 0.8367

There are a handful of variables that are considered not significant in predicting risk for CHD.

car::vif(fit.reg) %>% kable(
  caption = "Variance Inflation Factors for CHD Predictors"
)
Variance Inflation Factors for CHD Predictors
x
age 1.238234
sysBP 2.132905
BMI 1.116816
glucose 1.023053
prevalentHyp.factor 1.969372
prevalentStroke.factor 1.016528
BPMeds.factor 1.108197
totChol 1.041432
cigsPerDay 1.113484
heartRate 1.069251

The low Variance Inflation Factors indicate that multicollinearity between predictors is not significantly present. This indicates that the high p-values are likely related to being statistically insignificant opposed to its information already being included in the model via other predictors.

Reduced Model

# calculate drop in deviance based on a full and reduced glm model
dind <- function (glm.full, glm.reduced) {
  lrt <- glm.reduced$deviance - glm.full$deviance
  lrt.df <- glm.reduced$df.residual - glm.full$df.residual
  1 - pchisq(lrt, lrt.df)
}

fit.reg.reduced <- glm(
    TenYearCHD ~ age + sysBP + glucose + cigsPerDay,
    family = "binomial", 
    data = heart.drop.training
  )

dind(fit.reg, fit.reg.reduced)
## [1] 0.01937995

Removing the insignificant parameters from the full model and comparing with the significant values in a reduced model shows that there is no evidence that the full model explains more deviance than the reduced model (Drop-in-Deviance Test. p-value = 0.2241). Further model comparisons were conducted on interaction and quadratic terms with no differing results. Going forward, this reduced model is what will be used.

heart.drop.evp <-
  heart.drop.training %>% 
  select(TenYearCHD, age, sysBP, glucose, cigsPerDay) %>% 
  group_by(age, sysBP, glucose, cigsPerDay) %>% 
  summarize_all(
    funs(
      n = n(),
      y = sum(TenYearCHD), 
      fail = n - y
    )
  ) %>% ungroup

fit.reg.reduced.evp <- glm(
    y/n ~ age + sysBP + glucose + cigsPerDay,
    family = "binomial", 
    data = heart.drop.evp,
    weights = n
  )

values <- augment(fit.reg.reduced.evp, type.residuals = "pearson") %>% 
  mutate(e2 = .std.resid^2) 

values %>% head %>% kable(digits = 4)
y.n age sysBP glucose cigsPerDay X.weights. .fitted .se.fit .resid .hat .sigma .cooksd .std.resid e2
0 32 111.0 88 15 1 -3.3861 0.1629 -0.1840 8e-04 0.8741 0 -0.2581 0.0666
0 33 108.0 69 0 1 -3.9188 0.1807 -0.1409 6e-04 0.8741 0 -0.1984 0.0394
0 33 119.0 74 5 1 -3.5909 0.1667 -0.1661 7e-04 0.8741 0 -0.2333 0.0544
0 33 136.0 90 0 1 -3.3742 0.1806 -0.1851 1e-03 0.8741 0 -0.2596 0.0674
0 34 92.5 68 10 1 -3.7804 0.1696 -0.1510 6e-04 0.8741 0 -0.2125 0.0451
0 34 100.5 115 5 1 -3.4407 0.1797 -0.1790 1e-03 0.8741 0 -0.2513 0.0631
qplot(data = values, exp(.fitted)/(1 + exp(.fitted)), e2, xlab = "Estimated Probabilities") + 
    geom_hline(yintercept = qchisq(0.95, 1), color = "red")

qplot(data = values, 1:nrow(values), e2, xlab = "Observations", ylab = "Sq. Std. Resid.")

qplot(data = values, y.n, e2, xlab = "Proportion", ylab = "Sq. Std. Resid.")

Imputed Data

plot(heart.impute.training)

Over 50 iterations of imputed values, it is ideal to see that the lines in both the mean and standard deviation intermingle and be free of any trends as the number of iterations increase. A seed is used in order to provide reproducability in the generation of values. The lines appear to intermingle and no significant trends are visible.

# fit our logistic regression model on the imputed values
fit.imp <- with(data = heart.impute.training, glm(TenYearCHD ~ age + sysBP + glucose + cigsPerDay, family = "binomial"))

# pool the imputations together
fit.pool <- mice::pool(fit.imp)

fit.pool$pooled %>% as_tibble(rownames = "term") %>% 
  kable(
    digits = 4
  ) %>% 
  kable_styling(full_width = T, bootstrap_options = "striped", latex_options = "hold_position")
term estimate ubar b t dfcom df riv lambda fmi
(Intercept) -8.3307 0.2041 0.0012 0.2054 2963 2904.468 0.0064 0.0063 0.0070
age 0.0751 0.0001 0.0000 0.0001 2963 2957.712 0.0009 0.0009 0.0015
sysBP 0.0131 0.0000 0.0000 0.0000 2963 2958.075 0.0008 0.0008 0.0015
glucose 0.0082 0.0000 0.0000 0.0000 2963 1874.191 0.0421 0.0404 0.0415
cigsPerDay 0.0267 0.0000 0.0000 0.0000 2963 2933.250 0.0041 0.0040 0.0047

The fractional information missing due to nonresponse (fmi) and the relative in crease in variance due to nonresponse are low which indicates the imputed data doesn’t have a significant effect on the shape of the data itself.

summary(fit.pool) %>% as_tibble(rownames = "term") %>% 
  kable (
    digits = 4
  ) %>% 
  kable_styling(full_width = T, bootstrap_options = "striped", latex_options = "hold_position")
term estimate std.error statistic df p.value
(Intercept) -8.3307 0.4533 -18.3798 2904.468 0
age 0.0751 0.0072 10.4401 2957.712 0
sysBP 0.0131 0.0024 5.4687 2958.075 0
glucose 0.0082 0.0019 4.4155 1874.191 0
cigsPerDay 0.0267 0.0043 6.1561 2933.250 0

Results

pred <- predict(fit.reg.reduced, newdata = heart.drop.testing, type = "response")
confusionMatrix(table(as.numeric(pred > 0.5), heart.drop.testing %>% select(TenYearCHD) %>% as_vector()))
## Confusion Matrix and Statistics
## 
##    
##       0   1
##   0 942 163
##   1   5   7
##                                           
##                Accuracy : 0.8496          
##                  95% CI : (0.8273, 0.8701)
##     No Information Rate : 0.8478          
##     P-Value [Acc > NIR] : 0.4541          
##                                           
##                   Kappa : 0.058           
##                                           
##  Mcnemar's Test P-Value : <2e-16          
##                                           
##             Sensitivity : 0.99472         
##             Specificity : 0.04118         
##          Pos Pred Value : 0.85249         
##          Neg Pred Value : 0.58333         
##              Prevalence : 0.84781         
##          Detection Rate : 0.84333         
##    Detection Prevalence : 0.98926         
##       Balanced Accuracy : 0.51795         
##                                           
##        'Positive' Class : 0               
## 
# A good way doesnt exist to use predict() with a pooled model from mice.
# this predicts by doing the logistic calculation
dataToPredict <- heart.testing %>%
  mutate(intercept = 1) %>% 
  select(intercept, age, sysBP, glucose, cigsPerDay)

# get our predicted estimates
nu <- summary(fit.pool)$estimate

# calculate the preducted values
predVals <- as.matrix(dataToPredict) %*% nu

# calculate probabilites
confusion.pool <-
  predVals %>% 
    as_tibble() %>%  
    bind_cols(dataToPredict) %>% 
    mutate(p = exp(V1) / (1 + exp(V1)))

confusionMatrix(table(as.numeric(confusion.pool %>% select(p) > 0.5), mice::complete(heart.impute.testing) %>% select(TenYearCHD) %>% as_vector()))
## Confusion Matrix and Statistics
## 
##    
##       0   1
##   0 963 171
##   1   5   7
##                                           
##                Accuracy : 0.8464          
##                  95% CI : (0.8242, 0.8668)
##     No Information Rate : 0.8447          
##     P-Value [Acc > NIR] : 0.455           
##                                           
##                   Kappa : 0.0551          
##                                           
##  Mcnemar's Test P-Value : <2e-16          
##                                           
##             Sensitivity : 0.99483         
##             Specificity : 0.03933         
##          Pos Pred Value : 0.84921         
##          Neg Pred Value : 0.58333         
##              Prevalence : 0.84468         
##          Detection Rate : 0.84031         
##    Detection Prevalence : 0.98953         
##       Balanced Accuracy : 0.51708         
##                                           
##        'Positive' Class : 0               
## 
plot.fit.reg.age <-
  fit.reg.reduced %>% 
    ggplot(aes(x = age, y = exp(.fitted)/(1 + exp(.fitted)))) + 
      geom_point() +
      geom_smooth(method = glm, method.args = list(family = "binomial")) +
      ylab("Estimated Probabilities")

plot.fit.reg.glucose <-
  fit.reg.reduced %>% 
    ggplot(aes(x = glucose, y = exp(.fitted)/(1 + exp(.fitted)))) + 
      geom_point() + 
      geom_smooth(method = glm, method.args = list(family = "binomial")) +
      ylab("Estimated Probabilities")

plot.fit.reg.sysBP <-
  fit.reg.reduced %>% 
    ggplot(aes(x = sysBP, y = exp(.fitted)/(1 + exp(.fitted)))) + 
    geom_point() + 
    geom_smooth(method = glm, method.args = list(family = "binomial")) +
      ylab("Estimated Probabilities")

plot.fit.reg.cigsPerDay <-
  fit.reg.reduced %>% 
    ggplot(aes(x = cigsPerDay, y = exp(.fitted)/(1 + exp(.fitted)))) + 
    geom_point() + 
    geom_smooth(method = glm, method.args = list(family = "binomial")) +
      ylab("Estimated Probabilities")

grid.arrange(
  plot.fit.reg.cigsPerDay,
  plot.fit.reg.age,
  plot.fit.reg.glucose,
  plot.fit.reg.sysBP,
  ncol = 2,
  top = textGrob("Estimated Probabilities for Dropped Data", 
          gp=gpar(fontsize=14,font=1),just=c("center"))
  )

The strongest predictors for determining whether an individual is at risk for CHD are Systolic BP and Glucose. Initial analysis of the data showed Age being an obvious factor but the model does not seem to agree.

plot.pool.age <-
  confusion.pool %>% 
    ggplot(aes(x = age, y = p)) + 
      geom_point() +
      geom_smooth(method = glm, method.args = list(family = "binomial")) +
      ylab("Estimated Probabilities")

plot.pool.glucose <-
   confusion.pool %>% 
    ggplot(aes(x = glucose, y = p)) + 
      geom_point() + 
      geom_smooth(method = glm, method.args = list(family = "binomial")) +
      ylab("Estimated Probabilities")

plot.pool.sysBP <-
  confusion.pool %>% 
    ggplot(aes(x = sysBP, y =p )) + 
    geom_point() + 
    geom_smooth(method = glm, method.args = list(family = "binomial")) +
      ylab("Estimated Probabilities")

plot.pool.cigsPerDay <-
  confusion.pool %>% 
    ggplot(aes(x = cigsPerDay, y = p)) + 
    geom_point() + 
    geom_smooth(method = glm, method.args = list(family = "binomial")) +
      ylab("Estimated Probabilities")

grid.arrange(
  plot.pool.cigsPerDay,
  plot.pool.age,
  plot.pool.glucose,
  plot.pool.sysBP,
  ncol = 2,
  top = textGrob("Estimated Probabilities for Imputed Data", 
          gp=gpar(fontsize=14,font=1),just=c("center"))
  )